<?php
/* 
    Project     : 48c6c450f1a4a0cc53d9585dc0fee742
    Created on  : Mar 16, 2013, 11:29:15 PM
    Author      : Truong Khuong - khuongxuantruong@gmail.com
    Description :
        Purpose of the stylesheet follows.
*/
class project_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }
    function gets($type=''){
        if($type!=='')$this->db->where('proj_type',$type);
        $query = $this->db
                ->select(" SQL_CALC_FOUND_ROWS * ",false)
                ->where('proj_status','true')
                ->get('projects');
        $rows = $query->result();
        $sql = "SELECT FOUND_ROWS() AS `found_rows`;";
        $query = $this->db->query($sql);
        $tmp = $query->row_array();
        $total_rows = $tmp['found_rows'];
        return  array(
                'rows'=>$rows,
                'total_rows'=>$total_rows
                );
    }
    function get($id=''){
        $this->db->where('proj_id',$id);
        $query = $this->db
                ->where('proj_status','true')
                ->get('projects');
        $rows = $query->row();
        return  $rows;
    }
	function getsstaff(){
        $query = $this->db
                ->where('staf_status','true')
                ->get('staff');
        return $query->result();
	}
	function getsservice(){
        $query = $this->db
                ->where('serv_status','true')
                ->get('service');
        return $query->result();
	}
	function getcontent($id){
        $query = $this->db
                ->where('news_id',$id)
                ->get('contents');
        return $query->row();
	}
}
?>
